home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / file-tra / wu-ftpd-.002 / wu-ftpd-2.4-fixed.patch
Encoding:
Text File  |  1995-06-04  |  37.0 KB  |  1,216 lines

  1. diff -r -u --new-file wu-ftpd-2.4/README wu-ftpd-2.4-fixed/README
  2. --- wu-ftpd-2.4/README    Fri Apr  1 14:03:58 1994
  3. +++ wu-ftpd-2.4-fixed/README    Wed Dec 31 19:00:00 1969
  4. @@ -1,61 +0,0 @@
  5. -=================
  6. -= RELEASE NOTES =
  7. -=================
  8. -
  9. -WASHINGTON UNIVERSITY FTP SERVER, RELEASE 2.2 - Apr 1, 1994
  10. -
  11. -wu-ftpd is a replacement ftp server for Un*x systems.  Besides
  12. -supporting the ftp protocol defined in RFC 959, it adds the following
  13. -features:
  14. -    o  logging of transfers
  15. -    o  logging of commands
  16. -    o  on the fly compression and archiving
  17. -    o  classification of users on type and location
  18. -    o  per class limits
  19. -    o  per directory upload permissions
  20. -    o  restricted guest accounts
  21. -    o  system wide and per directory messages.
  22. -    o  directory alias
  23. -    o  cdpath
  24. -    o  filename filter
  25. -
  26. -This will be the final full release of the 2.x release of wu-ftpd.
  27. -Beside bug-fixes, no more work will be done on the 2.x versions.  We
  28. -plan to rewrite large parts of the server and integrate the extended
  29. -functionality into the next big release.
  30. -
  31. -For help setting up this server, you can try the following sources:
  32. -    o  The wu-ftpd mailing list.  To subscribe, send email with the 
  33. -       message body of "subscribe wu-ftpd" to listserv@wunet.wustl.edu
  34. -       NOTE: I am subscribed to wu-ftpd, there is no need to mail me also.
  35. -    o  _Managing Internet Information Services_, An O'Reilly and Associates
  36. -       book.  Expected release: April/May.  This book has an excellent
  37. -       chapter on setting up anonymous ftp sites using standard ftp servers
  38. -       as well as the wu-ftp server.
  39. -    
  40. -The following notices apply to this package:
  41. -
  42. -    Copyright (c) 1994  Washington University in Saint Louis.
  43. -    All rights reserved.
  44. -  
  45. -    This product includes software developed by Washington University in 
  46. -    Saint Louis and its contributors
  47. -  
  48. -    Copyright (c) 1980, 1985, 1988, 1989, 1990  The Regents of the 
  49. -    University of California.  All rights reserved.
  50. -  
  51. -    This product includes software developed by the University of California,
  52. -    Berkeley and its contributors.
  53. -  
  54. -    THIS SOFTWARE IS PROVIDED BY WASHINGTON UNIVERSITY AND CONTRIBUTORS
  55. -    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  56. -    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  57. -    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASHINGTON
  58. -    UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  59. -    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  60. -    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  61. -    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  62. -    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63. -    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  64. -    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  65. -    POSSIBILITY OF SUCH DAMAGE.
  66. diff -r -u --new-file wu-ftpd-2.4/README.OLD wu-ftpd-2.4-fixed/README.OLD
  67. --- wu-ftpd-2.4/README.OLD    Wed Dec 31 19:00:00 1969
  68. +++ wu-ftpd-2.4-fixed/README.OLD    Fri Apr  1 14:03:58 1994
  69. @@ -0,0 +1,61 @@
  70. +=================
  71. += RELEASE NOTES =
  72. +=================
  73. +
  74. +WASHINGTON UNIVERSITY FTP SERVER, RELEASE 2.2 - Apr 1, 1994
  75. +
  76. +wu-ftpd is a replacement ftp server for Un*x systems.  Besides
  77. +supporting the ftp protocol defined in RFC 959, it adds the following
  78. +features:
  79. +    o  logging of transfers
  80. +    o  logging of commands
  81. +    o  on the fly compression and archiving
  82. +    o  classification of users on type and location
  83. +    o  per class limits
  84. +    o  per directory upload permissions
  85. +    o  restricted guest accounts
  86. +    o  system wide and per directory messages.
  87. +    o  directory alias
  88. +    o  cdpath
  89. +    o  filename filter
  90. +
  91. +This will be the final full release of the 2.x release of wu-ftpd.
  92. +Beside bug-fixes, no more work will be done on the 2.x versions.  We
  93. +plan to rewrite large parts of the server and integrate the extended
  94. +functionality into the next big release.
  95. +
  96. +For help setting up this server, you can try the following sources:
  97. +    o  The wu-ftpd mailing list.  To subscribe, send email with the 
  98. +       message body of "subscribe wu-ftpd" to listserv@wunet.wustl.edu
  99. +       NOTE: I am subscribed to wu-ftpd, there is no need to mail me also.
  100. +    o  _Managing Internet Information Services_, An O'Reilly and Associates
  101. +       book.  Expected release: April/May.  This book has an excellent
  102. +       chapter on setting up anonymous ftp sites using standard ftp servers
  103. +       as well as the wu-ftp server.
  104. +    
  105. +The following notices apply to this package:
  106. +
  107. +    Copyright (c) 1994  Washington University in Saint Louis.
  108. +    All rights reserved.
  109. +  
  110. +    This product includes software developed by Washington University in 
  111. +    Saint Louis and its contributors
  112. +  
  113. +    Copyright (c) 1980, 1985, 1988, 1989, 1990  The Regents of the 
  114. +    University of California.  All rights reserved.
  115. +  
  116. +    This product includes software developed by the University of California,
  117. +    Berkeley and its contributors.
  118. +  
  119. +    THIS SOFTWARE IS PROVIDED BY WASHINGTON UNIVERSITY AND CONTRIBUTORS
  120. +    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  121. +    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  122. +    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASHINGTON
  123. +    UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  124. +    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  125. +    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  126. +    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  127. +    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  128. +    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  129. +    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  130. +    POSSIBILITY OF SUCH DAMAGE.
  131. diff -r -u --new-file wu-ftpd-2.4/README.SECURITY.FIX wu-ftpd-2.4-fixed/README.SECURITY.FIX
  132. --- wu-ftpd-2.4/README.SECURITY.FIX    Wed Dec 31 19:00:00 1969
  133. +++ wu-ftpd-2.4-fixed/README.SECURITY.FIX    Sun Jun  4 15:43:23 1995
  134. @@ -0,0 +1,48 @@
  135. +README.SECURITY.FIX
  136. +June 3, 1995 16:00 EST
  137. +
  138. +
  139. +    On June 2, 1995, Australian CERT announced that some Linux 
  140. +    distribution may have a problem with pre-compiled binaries 
  141. +    of the Washington University FTP Server Version 2.4
  142. +
  143. +    It appears that Slackware 2.0-2.3, Yggdrasil  Plug&Play (Fall 94),
  144. +    Debian Distribution and probably a lot of others are/were shipped
  145. +    with the misconfigured ftp server. Unfortunately, such 
  146. +    misconfiguration made the ftp server a subject to attacks that allowed
  147. +    any user of a system to gain the root access.
  148. +
  149. +    This version of the Washington University FTP server is correctly
  150. +    configured to prevent such attacks. I also cleaned the Makefile 
  151. +    in the support/ subdirectory so it compiles cleanly under Linux.
  152. +    This version was created from the source code of the wu.ftpd 2.4
  153. +    patched using wu-ftpd-2.4.patch.gz
  154. +    
  155. +
  156. +    CONFIGURING wu.ftpd 2.4 FOR SYSTEMS WITH AND WITHOUT SHADOW
  157. +
  158. +        By default, this wu.ftpd will be build with a shadow
  159. +        password support. If your system does not have shadow
  160. +        passwords (I do recommend you to get it), copy the file
  161. +        src/config/config.lnx.no-shadow into src/config/config.lnx
  162. +
  163. +
  164. +    CORRECTING PATHNAMES
  165. +
  166. +        If you would like to place your files in different places,
  167. +        edit src/pathnames.h. 
  168. +
  169. +        WARNING: THE VULNERABLE CONFIGURATION WAS CREATED BY
  170. +             SPECIFYING /bin IN THE _PATH_EXECPATH. MAKE SURE
  171. +             THAT THE DIRECTORY SPECIFIED IN _PATH_EXEC PATH
  172. +             IS WRITE-PROTECTED FROM USERS AND ALL PROGRAMS
  173. +             IN THAT DIRECTORY ARE "AWARE" OF BEING EXECUTED
  174. +             WITH UID/GID 0 WHILE RESTRICTED WITH EUID/EGID!
  175. +
  176. +
  177. +
  178. +             For more information please see Linux Security WWW
  179. +              http://bach.cis.temple.edu/linux/linux-security/
  180. +
  181. +
  182. +            Alexander O. Yuriev <alex@bach.cis.temple.edu>
  183. diff -r -u --new-file wu-ftpd-2.4/src/access.c wu-ftpd-2.4-fixed/src/access.c
  184. --- wu-ftpd-2.4/src/access.c    Wed Apr 13 17:02:22 1994
  185. +++ wu-ftpd-2.4-fixed/src/access.c    Sat Jun  3 12:36:07 1995
  186. @@ -100,7 +100,7 @@
  187.      while (match && isalpha(*whattime) && isupper(*whattime)) {
  188.          match = 0;
  189.          for (loop = 0; loop < 8; loop++) {
  190. -            if (strncmp(days[loop], whattime, 2) == NULL) {
  191. +            if (strncmp(days[loop], whattime, 2) == (int) NULL) {
  192.                  whattime += 2;
  193.                  match = 1;
  194.                  if ((wday == loop) | ((loop == 7) && wday && (wday < 6))) {
  195. @@ -110,7 +110,7 @@
  196.          }
  197.      }
  198.  
  199. -    if (strncmp(whattime, "Any", 3) == NULL) {
  200. +    if (strncmp(whattime, "Any", 3) == (int) NULL) {
  201.          validday = 1;
  202.          whattime += 3;
  203.      }
  204. @@ -428,7 +428,7 @@
  205.      struct aclmember *entry = NULL;
  206.  
  207.      if (msgpathbuf)
  208. -        *msgpathbuf = NULL;
  209. +        *msgpathbuf = (char) NULL;
  210.  
  211.      /* limit <class> <n> <times> [<message_file>] */
  212.      while (getaclentry("limit", &entry)) {
  213. diff -r -u --new-file wu-ftpd-2.4/src/acl.c wu-ftpd-2.4-fixed/src/acl.c
  214. --- wu-ftpd-2.4/src/acl.c    Wed Apr 13 17:02:25 1994
  215. +++ wu-ftpd-2.4-fixed/src/acl.c    Sat Jun  3 12:36:18 1995
  216. @@ -93,7 +93,7 @@
  217.      aclmembers = (struct aclmember *) NULL;
  218.      acltail = (struct aclmember *) NULL;
  219.  
  220. -    while (*aclptr != NULL) {
  221. +    while (*aclptr != (char) NULL) {
  222.          line = aclptr;
  223.          while (*aclptr && *aclptr != '\n')
  224.              aclptr++;
  225. @@ -103,7 +103,7 @@
  226.          if ((ptr = strchr(line, '#')) != NULL)
  227.              /* allowed escaped '#' chars for path-filter (DiB) */
  228.              if (*(ptr-1) != '\\')
  229. -                *ptr = NULL;
  230. +                *ptr = (char) NULL;
  231.  
  232.          ptr = strtok(line, " \t");
  233.          if (ptr) {
  234. @@ -153,7 +153,7 @@
  235.      if (finfo.st_size == 0) {
  236.          aclbuf = (char *) calloc(1, 1);
  237.      } else {
  238. -        if (!(aclbuf = malloc((unsigned) finfo.st_size + 1))) {
  239. +        if (!(aclbuf = (char *) malloc((unsigned) finfo.st_size + 1))) {
  240.              syslog(LOG_ERR, "could not malloc aclbuf (%d bytes)", finfo.st_size + 1);
  241.              return (0);
  242.          }
  243. diff -r -u --new-file wu-ftpd-2.4/src/config/config.lnx wu-ftpd-2.4-fixed/src/config/config.lnx
  244. --- wu-ftpd-2.4/src/config/config.lnx    Fri Apr  1 14:03:38 1994
  245. +++ wu-ftpd-2.4-fixed/src/config/config.lnx    Sat Jun  3 13:30:59 1995
  246. @@ -13,15 +13,12 @@
  247.  #define OVERWRITE
  248.  #undef  REGEX
  249.  #define SETPROCTITLE
  250. -#undef  SHADOW_PASSWORD
  251. +#define SHADOW_PASSWORD
  252.  #define UPLOAD
  253.  #undef  USG
  254.  #define SVR4
  255.  
  256.  #include <varargs.h>
  257.  #include <bsd.h>
  258. -
  259. -typedef    int    mode_t
  260. -typedef int SIGNAL_TYPE
  261.  
  262.  #include "../config.h"
  263. diff -r -u --new-file wu-ftpd-2.4/src/config/config.lnx.no-shadow wu-ftpd-2.4-fixed/src/config/config.lnx.no-shadow
  264. --- wu-ftpd-2.4/src/config/config.lnx.no-shadow    Wed Dec 31 19:00:00 1969
  265. +++ wu-ftpd-2.4-fixed/src/config/config.lnx.no-shadow    Sat Jun  3 15:56:42 1995
  266. @@ -0,0 +1,24 @@
  267. +#undef  BSD
  268. +#define HAVE_DIRENT
  269. +#define HAVE_FLOCK
  270. +#define HAVE_FTW
  271. +#undef  HAVE_GETCWD
  272. +#define HAVE_GETDTABLESIZE
  273. +#undef  HAVE_PSTAT
  274. +#define HAVE_ST_BLKSIZE
  275. +#undef  HAVE_SYSINFO
  276. +#define HAVE_UT_UT_HOST
  277. +#define HAVE_VPRINTF
  278. +#define LINUX
  279. +#define OVERWRITE
  280. +#undef  REGEX
  281. +#define SETPROCTITLE
  282. +#undef  SHADOW_PASSWORD
  283. +#define UPLOAD
  284. +#undef  USG
  285. +#define SVR4
  286. +
  287. +#include <varargs.h>
  288. +#include <bsd.h>
  289. +
  290. +#include "../config.h"
  291. diff -r -u --new-file wu-ftpd-2.4/src/config/config.lnx.shadow wu-ftpd-2.4-fixed/src/config/config.lnx.shadow
  292. --- wu-ftpd-2.4/src/config/config.lnx.shadow    Wed Dec 31 19:00:00 1969
  293. +++ wu-ftpd-2.4-fixed/src/config/config.lnx.shadow    Sat Jun  3 15:56:51 1995
  294. @@ -0,0 +1,24 @@
  295. +#undef  BSD
  296. +#define HAVE_DIRENT
  297. +#define HAVE_FLOCK
  298. +#define HAVE_FTW
  299. +#undef  HAVE_GETCWD
  300. +#define HAVE_GETDTABLESIZE
  301. +#undef  HAVE_PSTAT
  302. +#define HAVE_ST_BLKSIZE
  303. +#undef  HAVE_SYSINFO
  304. +#define HAVE_UT_UT_HOST
  305. +#define HAVE_VPRINTF
  306. +#define LINUX
  307. +#define OVERWRITE
  308. +#undef  REGEX
  309. +#define SETPROCTITLE
  310. +#define SHADOW_PASSWORD
  311. +#define UPLOAD
  312. +#undef  USG
  313. +#define SVR4
  314. +
  315. +#include <varargs.h>
  316. +#include <bsd.h>
  317. +
  318. +#include "../config.h"
  319. diff -r -u --new-file wu-ftpd-2.4/src/edit wu-ftpd-2.4-fixed/src/edit
  320. --- wu-ftpd-2.4/src/edit    Wed Dec 31 19:00:00 1969
  321. +++ wu-ftpd-2.4-fixed/src/edit    Sat Jun  3 13:32:14 1995
  322. @@ -0,0 +1 @@
  323. +3
  324. diff -r -u --new-file wu-ftpd-2.4/src/extensions.c wu-ftpd-2.4-fixed/src/extensions.c
  325. --- wu-ftpd-2.4/src/extensions.c    Wed Apr 13 17:02:46 1994
  326. +++ wu-ftpd-2.4-fixed/src/extensions.c    Sat Jun  3 12:36:20 1995
  327. @@ -167,7 +167,7 @@
  328.  
  329.              case 'T':
  330.                  strncpy(outptr, ctime(&curtime), 24);
  331. -                *(outptr + 24) = NULL;
  332. +                *(outptr + 24) = (char) NULL;
  333.                  break;
  334.  
  335.              case 'F':
  336. @@ -198,17 +198,17 @@
  337.  
  338.              case 's':
  339.                  strncpy(outptr, shuttime, 24);
  340. -                *(outptr + 24) = NULL;
  341. +                *(outptr + 24) = (char) NULL;
  342.                  break;
  343.  
  344.              case 'd':
  345.                  strncpy(outptr, disctime, 24);
  346. -                *(outptr + 24) = NULL;
  347. +                *(outptr + 24) = (char) NULL;
  348.                  break;
  349.  
  350.              case 'r':
  351.                  strncpy(outptr, denytime, 24);
  352. -                *(outptr + 24) = NULL;
  353. +                *(outptr + 24) = (char) NULL;
  354.                  break;
  355.  
  356.              case '%':
  357. @@ -227,7 +227,7 @@
  358.          }
  359.          inptr++;
  360.      }
  361. -    *outptr = NULL;
  362. +    *outptr = (char) NULL;
  363.  }
  364.  
  365.  /*************************************************************************/
  366. @@ -253,7 +253,7 @@
  367.      (void) realpath(".", cwd);
  368.  
  369.      for (curptr = head; curptr != NULL; curptr = curptr->next)
  370. -        if (strcmp(curptr->dirname, cwd) == NULL) {
  371. +        if (strcmp(curptr->dirname, cwd) == (int) NULL) {
  372.              if (!(curptr->dircode & dircode)) {
  373.                  curptr->dircode |= dircode;
  374.                  return (0);
  375. @@ -345,7 +345,7 @@
  376.                  show++;
  377.              else {
  378.                  for (which = 2; (which < MAXARGS) && ARG[which]; which++)
  379. -                    if (strcasecmp(class, ARG[which]) == NULL)
  380. +                    if (strcasecmp(class, ARG[which]) == (int) NULL)
  381.                          show++;
  382.              }
  383.          if (mode == C_WD && ARG1 && !strncasecmp(ARG1, "cwd=", 4) &&
  384. @@ -355,7 +355,7 @@
  385.                  show++;
  386.              else {
  387.                  for (which = 2; (which < MAXARGS) && ARG[which]; which++)
  388. -                    if (strcasecmp(class, ARG[which]) == NULL)
  389. +                    if (strcasecmp(class, ARG[which]) == (int) NULL)
  390.                          show++;
  391.              }
  392.          if (show && strlen(ARG0) > 0) {
  393. @@ -417,7 +417,7 @@
  394.                  show++;
  395.              else {
  396.                  for (which = 2; (which < MAXARGS) && ARG[which]; which++)
  397. -                    if (strcasecmp(class, ARG[which]) == NULL)
  398. +                    if (strcasecmp(class, ARG[which]) == (int) NULL)
  399.                          show++;
  400.              }
  401.          if (mode == C_WD && ARG1 && !strncasecmp(ARG1, "cwd=", 4)
  402. @@ -427,7 +427,7 @@
  403.                  show++;
  404.              else {
  405.                  for (which = 2; (which < MAXARGS) && ARG[which]; which++)
  406. -                    if (strcasecmp(class, ARG[which]) == NULL)
  407. +                    if (strcasecmp(class, ARG[which]) == (int) NULL)
  408.                          show++;
  409.              }
  410.          if (show) {
  411. @@ -805,7 +805,7 @@
  412.    if (sp = strrchr(path, '/'))  *sp = '\0';
  413.    else strcpy(path, ".");
  414.  
  415. -  if ((realpath(path, cwdir)) == NULL) {
  416. +  if ((realpath(path, cwdir)) == (char) NULL) {
  417.        perror_reply(553, "Could not determine cwdir");
  418.        return(0);
  419.    }
  420. @@ -867,7 +867,7 @@
  421.        if (sp = strrchr(path, '/'))  *sp = '\0';
  422.        else strcpy(path, ".");
  423.  
  424. -      if ((realpath(path, cwdir)) == NULL) {
  425. +      if ((realpath(path, cwdir)) == (char) NULL) {
  426.            perror_reply(553, "Could not determine cwdir");
  427.            return(-1);
  428.        }
  429. diff -r -u --new-file wu-ftpd-2.4/src/ftpcmd.y wu-ftpd-2.4-fixed/src/ftpcmd.y
  430. --- wu-ftpd-2.4/src/ftpcmd.y    Wed Apr 13 17:02:56 1994
  431. +++ wu-ftpd-2.4-fixed/src/ftpcmd.y    Sat Jun  3 12:36:21 1995
  432. @@ -694,7 +694,7 @@
  433.  
  434.  password:   /* empty */
  435.          = {
  436. -            $$ = malloc(1);
  437. +            $$ = (char *) malloc(1);
  438.              $$[0] = '\0';
  439.          }
  440.      |   STRING
  441. @@ -1308,7 +1308,7 @@
  442.  {
  443.      char *p;
  444.  
  445. -    p = malloc((unsigned) strlen(s) + 1);
  446. +    p = (char *) malloc((unsigned) strlen(s) + 1);
  447.      if (p == NULL)
  448.          fatal("Ran out of memory.");
  449.      (void) strcpy(p, s);
  450. diff -r -u --new-file wu-ftpd-2.4/src/ftpcount.c wu-ftpd-2.4-fixed/src/ftpcount.c
  451. --- wu-ftpd-2.4/src/ftpcount.c    Wed Apr 13 17:03:02 1994
  452. +++ wu-ftpd-2.4-fixed/src/ftpcount.c    Sat Jun  3 12:36:22 1995
  453. @@ -95,7 +95,7 @@
  454.      while (match && isalpha(*whattime) && isupper(*whattime)) {
  455.          match = 0;
  456.          for (loop = 0; loop < 8; loop++) {
  457. -            if (strncmp(days[loop], whattime, 2) == NULL) {
  458. +            if (strncmp(days[loop], whattime, 2) == (int) NULL) {
  459.                  whattime += 2;
  460.                  match = 1;
  461.                  if ((wday == loop) | ((loop == 7) && wday && (wday < 6)))
  462. @@ -104,7 +104,7 @@
  463.          }
  464.      }
  465.  
  466. -    if (strncmp(whattime, "Any", 3) == NULL) {
  467. +    if (strncmp(whattime, "Any", 3) == (int) NULL) {
  468.          validday = 1;
  469.          whattime += 3;
  470.      }
  471. @@ -156,10 +156,10 @@
  472.        linebuf[1024];
  473.      int limit;
  474.  
  475. -    while (*aclbuf != NULL) {
  476. +    while (*aclbuf != (char) NULL) {
  477.          if (strncasecmp(aclbuf, "limit", 5) == 0) {
  478.              for (crptr = aclbuf; *crptr++ != '\n';) ;
  479. -            *--crptr = NULL;
  480. +            *--crptr = (char) NULL;
  481.              strcpy(linebuf, aclbuf);
  482.              *crptr = '\n';
  483.              (void) strtok(linebuf, " \t");  /* returns "limit" */
  484. @@ -304,10 +304,10 @@
  485.  
  486.      (void) new_list(&list);
  487.      myaclbuf = aclbuf;
  488. -    while (*myaclbuf != NULL) {
  489. +    while (*myaclbuf != (char) NULL) {
  490.          if (strncasecmp(myaclbuf, "class", 5) == 0) {
  491.              for (crptr = myaclbuf; *crptr++ != '\n';) ;
  492. -            *--crptr = NULL;
  493. +            *--crptr = (char) NULL;
  494.              strcpy(linebuf, myaclbuf);
  495.              *crptr = '\n';
  496.              (void) strtok(linebuf, " \t");  /* returns "class" */
  497. diff -r -u --new-file wu-ftpd-2.4/src/ftpd.c wu-ftpd-2.4-fixed/src/ftpd.c
  498. --- wu-ftpd-2.4/src/ftpd.c    Wed Apr 13 17:17:18 1994
  499. +++ wu-ftpd-2.4-fixed/src/ftpd.c    Sat Jun  3 12:36:22 1995
  500. @@ -55,7 +55,7 @@
  501.  #endif
  502.  
  503.  #include <netinet/in.h>
  504. -#include <netinet/in_systm.h>
  505. +#include <netinet/in_system.h>
  506.  #include <netinet/ip.h>
  507.  
  508.  #define FTP_NAMES
  509. @@ -224,6 +224,11 @@
  510.  int swaitmax = SWAITMAX;
  511.  int swaitint = SWAITINT;
  512.  
  513. +/* Mod by Lee Silverman 26 May 1994 to fix SIGNAL_TYPE never being defined. */
  514. +#ifdef LINUX
  515. +#define SIGNAL_TYPE void
  516. +#endif /* linux? */
  517. +
  518.  SIGNAL_TYPE lostconn(int sig);
  519.  SIGNAL_TYPE randomsig(int sig);
  520.  SIGNAL_TYPE myoob(int sig);
  521. @@ -294,6 +299,12 @@
  522.  
  523.      data_source.sin_port = htons(ntohs(ctrl_addr.sin_port) - 1);
  524.      debug = 0;
  525. +/* Mod By Lee Silverman 26 May 1994 to provide a logging facility */
  526. +#ifdef LINUX
  527. +#ifndef FACILITY
  528. +#define FACILITY LOG_DAEMON
  529. +#endif (FACIITY?)
  530. +#endif (Linux?)
  531.  
  532.  #ifdef FACILITY
  533.      openlog("ftpd", LOG_PID | LOG_NDELAY, FACILITY);
  534. @@ -999,7 +1010,7 @@
  535.          }
  536.  #endif
  537.  
  538. -        *guestpw = NULL;
  539. +        *guestpw = (char) NULL;
  540.          if (pw == NULL)
  541.              salt = "xx";
  542.          else
  543. @@ -1223,11 +1234,11 @@
  544.      static char buf[100];
  545.      char *ptr = buf;
  546.  
  547. -    if ((options & O_COMPRESS) != NULL)
  548. +    if ((options & O_COMPRESS) != (int) NULL)
  549.          *ptr++ = 'C';
  550. -    if ((options & O_TAR) != NULL)
  551. +    if ((options & O_TAR) != (int) NULL)
  552.          *ptr++ = 'T';
  553. -    if ((options & O_UNCOMPRESS) != NULL)
  554. +    if ((options & O_UNCOMPRESS) != (int) NULL)
  555.          *ptr++ = 'U';
  556.      if (options == 0)
  557.          *ptr++ = '_';
  558. @@ -1339,7 +1350,7 @@
  559.              strcpy(namebuf, cptr->external_cmd);
  560.              if ((ptr = strchr(namebuf, ' ')) != NULL)
  561.                  *ptr = '\0';
  562. -            if (stat(namebuf, &st) != NULL) {
  563. +            if (stat(namebuf, &st) != (int) NULL) {
  564.                  syslog(LOG_ERR, "external command %s not found",
  565.                         namebuf);
  566.                  (void) reply(550,
  567. diff -r -u --new-file wu-ftpd-2.4/src/ftpshut.c wu-ftpd-2.4-fixed/src/ftpshut.c
  568. --- wu-ftpd-2.4/src/ftpshut.c    Fri Apr  1 14:03:42 1994
  569. +++ wu-ftpd-2.4-fixed/src/ftpshut.c    Sat Jun  3 12:36:23 1995
  570. @@ -185,10 +185,10 @@
  571.      }
  572.  
  573.      myaclbuf = aclbuf;
  574. -    while (*myaclbuf != NULL) {
  575. +    while (*myaclbuf != (char) NULL) {
  576.          if (strncasecmp(myaclbuf, "shutdown", 8) == 0) {
  577.              for (crptr = myaclbuf; *crptr++ != '\n';) ;
  578. -            *--crptr = NULL;
  579. +            *--crptr = (char) NULL;
  580.              strcpy(linebuf, myaclbuf);
  581.              *crptr = '\n';
  582.              (void) strtok(linebuf, " \t");  /* returns "shutdown" */
  583. diff -r -u --new-file wu-ftpd-2.4/src/glob.c wu-ftpd-2.4-fixed/src/glob.c
  584. --- wu-ftpd-2.4/src/glob.c    Fri Apr  1 14:03:42 1994
  585. +++ wu-ftpd-2.4-fixed/src/glob.c    Sat Jun  3 12:36:24 1995
  586. @@ -645,7 +645,7 @@
  587.  strspl(cp, dp)
  588.      register char *cp, *dp;
  589.  {
  590. -    register char *ep = malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
  591. +    register char *ep = (char *) malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
  592.  
  593.      if (ep == (char *)0)
  594.          fatal("Out of memory");
  595. diff -r -u --new-file wu-ftpd-2.4/src/hostacc.c wu-ftpd-2.4-fixed/src/hostacc.c
  596. --- wu-ftpd-2.4/src/hostacc.c    Fri Apr  1 14:03:44 1994
  597. +++ wu-ftpd-2.4-fixed/src/hostacc.c    Sat Jun  3 12:36:24 1995
  598. @@ -69,7 +69,7 @@
  599.          while (((ptHtmp = gethacc()) != (hacc_t *)NULL) && !iLineMatch)
  600.          {
  601.                  if ( (strcasecmp(pcRuser, ptHtmp->ha_login)) &&
  602. -                      strcmp(ptHtmp->ha_login, "*") != NULL)
  603. +                      strcmp(ptHtmp->ha_login, "*") != (int) NULL)
  604.                          /* wrong user, check rest of file */
  605.                          continue;
  606.  
  607. diff -r -u --new-file wu-ftpd-2.4/src/makefiles/Makefile.lnx wu-ftpd-2.4-fixed/src/makefiles/Makefile.lnx
  608. --- wu-ftpd-2.4/src/makefiles/Makefile.lnx    Fri Apr  1 14:03:31 1994
  609. +++ wu-ftpd-2.4-fixed/src/makefiles/Makefile.lnx    Sat Jun  3 13:18:13 1995
  610. @@ -1,16 +1,16 @@
  611.  CC       = gcc
  612. -IFLAGS   = -I.. -I../support -I/usr/include/bsd
  613. +IFLAGS   = -I.. -I../support -I/usr/include/bsd -I/usr/include/netinet
  614.  LFLAGS   = -L../support
  615. -CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
  616. -LIBES    = -lsupport -lbsd
  617. +CFLAGS   = -O2 ${IFLAGS} ${LFLAGS}
  618. +LIBES    = -lbsd -lsupport
  619.  LIBC     = /usr/lib/libc.a
  620.  LINTFLAGS=    
  621.  LKERB    = -lauth -lckrb -lkrb -ldes
  622.  MKDEP    = ../util/mkdep
  623.  
  624. -SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
  625. +SRCS   = vers.c ftpd.c ftpcmd.c glob.c logwtmp.c popen.c access.c extensions.c \
  626.           realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
  627. -OBJS   = ftpd.o ftpcmd.o glob.o logwtmp.o popen.o vers.o access.o extensions.o \
  628. +OBJS   = vers.o ftpd.o ftpcmd.o glob.o logwtmp.o popen.o access.o extensions.o \
  629.           realpath.o acl.o private.o authenticate.o conversions.o hostacc.o
  630.  
  631.  all: ftpd ftpcount ftpshut ckconfig
  632. diff -r -u --new-file wu-ftpd-2.4/src/makefiles/Makefile.lnx.orig wu-ftpd-2.4-fixed/src/makefiles/Makefile.lnx.orig
  633. --- wu-ftpd-2.4/src/makefiles/Makefile.lnx.orig    Wed Dec 31 19:00:00 1969
  634. +++ wu-ftpd-2.4-fixed/src/makefiles/Makefile.lnx.orig    Fri Apr  1 14:03:31 1994
  635. @@ -0,0 +1,51 @@
  636. +CC       = gcc
  637. +IFLAGS   = -I.. -I../support -I/usr/include/bsd
  638. +LFLAGS   = -L../support
  639. +CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
  640. +LIBES    = -lsupport -lbsd
  641. +LIBC     = /usr/lib/libc.a
  642. +LINTFLAGS=    
  643. +LKERB    = -lauth -lckrb -lkrb -ldes
  644. +MKDEP    = ../util/mkdep
  645. +
  646. +SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
  647. +         realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
  648. +OBJS   = ftpd.o ftpcmd.o glob.o logwtmp.o popen.o vers.o access.o extensions.o \
  649. +         realpath.o acl.o private.o authenticate.o conversions.o hostacc.o
  650. +
  651. +all: ftpd ftpcount ftpshut ckconfig
  652. +
  653. +ftpcount:    ftpcount.c pathnames.h
  654. +    ${CC} ${CFLAGS} -o $@ ftpcount.c vers.o ${LIBES}
  655. +
  656. +ftpshut:    ftpshut.c pathnames.h
  657. +    ${CC} ${CFLAGS} -o $@ ftpshut.c vers.o ${LIBES}
  658. +
  659. +ftpd: ${OBJS} ${LIBC}
  660. +    ${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBES}
  661. +
  662. +ckconfig:   ckconfig.c
  663. +    ${CC} ${CFLAGS} -o $@ ckconfig.c
  664. +
  665. +index:    index.o ${LIBC}
  666. +    ${CC} -Bstatic -o $@ index.o
  667. +
  668. +vers.o: ftpd.c ftpcmd.y
  669. +    sh newvers.sh
  670. +    ${CC} ${CFLAGS} -c vers.c
  671. +
  672. +clean:
  673. +    rm -f ${OBJS} ftpd ftpcmd.c ftpshut ftpshut.o ftpcount ftpcount.o
  674. +    rm -f core index index.o
  675. +
  676. +cleandir: clean
  677. +    rm -f tags .depend
  678. +
  679. +depend: ${SRCS}
  680. +    ${MKDEP} ${CFLAGS} ${SRCS}
  681. +
  682. +lint: ${SRCS}
  683. +    lint ${CFLAGS} ${LINTFLAGS} ${SRCS}
  684. +
  685. +tags: ${SRCS}
  686. +    ctags ${SRCS}
  687. diff -r -u --new-file wu-ftpd-2.4/src/pathnames.h wu-ftpd-2.4-fixed/src/pathnames.h
  688. --- wu-ftpd-2.4/src/pathnames.h    Wed Apr 13 16:46:48 1994
  689. +++ wu-ftpd-2.4-fixed/src/pathnames.h    Sat Jun  3 15:59:51 1995
  690. @@ -30,11 +30,11 @@
  691.   * @(#)pathnames.h 5.2 (Berkeley) 6/1/90 */
  692.  
  693.  #define _PATH_FTPUSERS  "/etc/ftpusers"
  694. -#define _PATH_FTPACCESS "/usr/local/etc/ftpaccess"
  695. -#define _PATH_EXECPATH  "/bin/ftp-exec"
  696. -#define _PATH_PIDNAMES  "/usr/local/daemon/ftpd/ftp.pids-%s"
  697. -#define _PATH_CVT       "/usr/local/etc/ftpconversions"
  698. -#define _PATH_XFERLOG   "/usr/adm/xferlog"
  699. +#define _PATH_FTPACCESS "/etc/ftpaccess"
  700. +#define _PATH_EXECPATH  "/bin/ftp-exec"  /* DO NOT MAKE IT A NORMAL bin!!! */
  701. +#define _PATH_PIDNAMES  "/usr/adm/ftpd/ftp.pids-%s"
  702. +#define _PATH_CVT       "/etc/ftpconversions"
  703. +#define _PATH_XFERLOG   "/usr/adm/ftpd/xferlog"
  704.  #define _PATH_PRIVATE   "/etc/ftpgroups"
  705.  
  706.  #ifndef _PATH_UTMP
  707. @@ -47,6 +47,6 @@
  708.  #define _PATH_DEVNULL   "/dev/null"
  709.  
  710.  #ifdef  HOST_ACCESS
  711. -#define _PATH_FTPHOSTS  "/usr/local/etc/ftphosts"
  712. +#define _PATH_FTPHOSTS  "/etc/ftphosts"
  713.  #endif
  714.  
  715. diff -r -u --new-file wu-ftpd-2.4/src/private.c wu-ftpd-2.4-fixed/src/private.c
  716. --- wu-ftpd-2.4/src/private.c    Wed Apr 13 17:03:53 1994
  717. +++ wu-ftpd-2.4-fixed/src/private.c    Sat Jun  3 12:36:26 1995
  718. @@ -164,7 +164,7 @@
  719.      if (finfo.st_size == 0) {
  720.          passbuf = (char *) calloc(1, 1);
  721.      } else {
  722. -        if (!(passbuf = malloc((unsigned) finfo.st_size + 1))) {
  723. +        if (!(passbuf = (char *) malloc((unsigned) finfo.st_size + 1))) {
  724.              (void) syslog(LOG_ERR, "could not malloc passbuf (%d bytes)",
  725.                            finfo.st_size + 1);
  726.              return;
  727. diff -r -u --new-file wu-ftpd-2.4/src/realpath.c wu-ftpd-2.4-fixed/src/realpath.c
  728. --- wu-ftpd-2.4/src/realpath.c    Fri Apr  1 14:03:45 1994
  729. +++ wu-ftpd-2.4-fixed/src/realpath.c    Sat Jun  3 12:36:27 1995
  730. @@ -78,7 +78,7 @@
  731.          seteuid(userid);
  732.      }
  733.      } else
  734. -        *workpath = NULL;
  735. +        *workpath = (char) NULL;
  736.  
  737.      /* curpath is the path we're still resolving      */
  738.      /* linkpath is the path a symbolic link points to */
  739. @@ -86,7 +86,7 @@
  740.  
  741.    loop:
  742.      where = curpath;
  743. -    while (*where != NULL) {
  744. +    while (*where != (char) NULL) {
  745.          if (!strcmp(where, ".")) {
  746.              where++;
  747.              continue;
  748. @@ -105,14 +105,14 @@
  749.                      last = ptr;
  750.                  ptr++;
  751.              }
  752. -            *last = NULL;
  753. +            *last = (char) NULL;
  754.              continue;
  755.          }
  756.          ptr = strchr(where, '/');
  757.          if (!ptr)
  758.              ptr = where + strlen(where) - 1;
  759.          else
  760. -            *ptr = NULL;
  761. +            *ptr = (char) NULL;
  762.  
  763.          strcpy(namebuf, workpath);
  764.          for (last = namebuf; *last; last++)
  765. diff -r -u --new-file wu-ftpd-2.4/src/vers.c wu-ftpd-2.4-fixed/src/vers.c
  766. --- wu-ftpd-2.4/src/vers.c    Wed Apr 13 17:38:41 1994
  767. +++ wu-ftpd-2.4-fixed/src/vers.c    Sat Jun  3 13:32:14 1995
  768. @@ -1 +1 @@
  769. -char version[] = "Version wu-2.4(1) Wed Apr 13 16:38:41 CDT 1994";
  770. +char version[] = "Version wu-2.4(3) Sat Jun 3 13:32:14 EDT 1995";
  771. diff -r -u --new-file wu-ftpd-2.4/support/ftw.c wu-ftpd-2.4-fixed/support/ftw.c
  772. --- wu-ftpd-2.4/support/ftw.c    Fri Apr  1 14:03:54 1994
  773. +++ wu-ftpd-2.4-fixed/support/ftw.c    Sat Jun  3 12:36:28 1995
  774. @@ -149,7 +149,7 @@
  775.                      break;
  776.          }
  777.          if (cur.off) {
  778. -            *name = NULL;
  779. +            *name = (char) NULL;
  780.              if ( (cur.dirp = opendir(bp)) ) {
  781.                  seekdir(cur.dirp, cur.off);
  782.                  /* tricky; if we have to reset the directory pointer we know
  783. diff -r -u --new-file wu-ftpd-2.4/support/ftw.c.orig wu-ftpd-2.4-fixed/support/ftw.c.orig
  784. --- wu-ftpd-2.4/support/ftw.c.orig    Wed Dec 31 19:00:00 1969
  785. +++ wu-ftpd-2.4-fixed/support/ftw.c.orig    Fri Apr  1 14:03:54 1994
  786. @@ -0,0 +1,352 @@
  787. +/*
  788. + * Copyright (c) 1988 Regents of the University of California.
  789. + * All rights reserved.
  790. + *
  791. + * Redistribution and use in source and binary forms are permitted
  792. + * provided that the above copyright notice and this paragraph are
  793. + * duplicated in all such forms and that any documentation,
  794. + * advertising materials, and other materials related to such
  795. + * distribution and use acknowledge that the software was developed
  796. + * by the University of California, Berkeley.  The name of the
  797. + * University may not be used to endorse or promote products derived
  798. + * from this software without specific prior written permission.
  799. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  800. + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  801. + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  802. + */
  803. +
  804. +#if defined(LIBC_SCCS) && !defined(lint)
  805. +static char sccsid[] = "@(#)ftw.c    5.3 (Berkeley) 8/5/88";
  806. +
  807. +#endif /* LIBC_SCCS and not lint */
  808. +
  809. +#include "../src/config.h"
  810. +
  811. +#ifdef HAVE_DIRENT
  812. +#include <dirent.h>
  813. +#else
  814. +#include <sys/dir.h>
  815. +#endif
  816. +
  817. +#include <errno.h>
  818. +
  819. +#include <sys/param.h>
  820. +#include <sys/stat.h>
  821. +#include <sys/stat.h>
  822. +
  823. +#include "ftw.h"
  824. +
  825. +#define    NODESC    -1
  826. +
  827. +#ifdef HAVE_SYMLINK
  828. +# define    ISLINK(sb)    ((sb.st_mode&S_IFMT) == S_IFLNK)
  829. +#else
  830. +# define lstat stat
  831. +#endif
  832. +
  833. +#define    ISDIR(sb)    ((sb.st_mode&S_IFMT) == S_IFDIR)
  834. +#define    ISDOT(dp) \
  835. +    (dp->d_name[0] == '.' && (!dp->d_name[1] || \
  836. +        (dp->d_name[1] == '.' && !dp->d_name[2])))
  837. +
  838. +extern int errno;
  839. +static int g_fds,
  840. +  (*g_fn) (),
  841. +  g_opts;
  842. +static char *bp;
  843. +
  844. +int treewalk(char *path, int (*fn) ( /* ??? */ ), int maxfds, int opts);
  845. +
  846. +/*
  847. + * cycle through the directories at the top of the tree, otherwise, once
  848. + * you run out of descriptors you have to keep reusing the same one and
  849. + * it gets *real* slow.
  850. + */
  851. +typedef struct d_fd {
  852. +    struct d_fd *next;
  853. +    DIR *dirp;
  854. +    off_t off;
  855. +} FD;
  856. +
  857. +static FD *freep,
  858. + *node;
  859. +
  860. +static int
  861. +walk(register char *name)
  862. +{
  863. +#ifdef HAVE_DIRENT
  864. +    register struct dirent *dp;
  865. +#else
  866. +    register struct direct *dp;
  867. +#endif
  868. +    register int rval;
  869. +    struct stat sb;
  870. +    FD cur;
  871. +    char *save,
  872. +     *strcpy(char *, const char *);
  873. +
  874. +    if (!freep)
  875. +        freep = &cur;
  876. +    else
  877. +        node->next = &cur;
  878. +    node = &cur;
  879. +    cur.off = 0;
  880. +
  881. +  getfd:if (!g_fds) {
  882. +        freep->off = telldir(freep->dirp);
  883. +        closedir(freep->dirp);
  884. +        freep = freep->next;
  885. +        ++g_fds;
  886. +    }
  887. +    if ( !(cur.dirp = opendir(bp)) ) {
  888. +        if (errno == EMFILE) {
  889. +            g_fds = 0;
  890. +            goto getfd;
  891. +        }
  892. +        return (errno == EACCES ? (*g_fn) (bp, &sb, FTW_DNR) : -1);
  893. +    } else
  894. +        --g_fds;
  895. +
  896. +    for (; *name; ++name) ;
  897. +    *name++ = '/';
  898. +    for (rval = 0, dp = readdir(cur.dirp); dp; dp = readdir(cur.dirp)) {
  899. +        if (ISDOT(dp))
  900. +            continue;
  901. +        (void) strcpy(name, dp->d_name);
  902. +        if (lstat(bp, &sb)) {
  903. +            rval = errno == EACCES ?
  904. +                (*g_fn) (bp, &sb, FTW_NS) : -1;
  905. +            if (rval)
  906. +                break;
  907. +        }
  908. +#ifdef HAVE_SYMLINK
  909. +        if (ISLINK(sb) && g_opts & FTW_SYMLINK)
  910. +            if (stat(bp, &sb))
  911. +                continue;
  912. +#endif
  913. +        if (!ISDIR(sb)) {
  914. +            rval = (*g_fn) (bp, &sb, FTW_F);
  915. +            if (rval)
  916. +                break;
  917. +            continue;
  918. +        }
  919. +        if (g_opts & FTW_DIRLAST)
  920. +#ifdef HAVE_D_NAMLEN
  921. +            save = name + dp->d_namlen;
  922. +#else
  923. +            save = name + strlen(dp->d_name);
  924. +#endif
  925. +        rval = (*g_fn) (bp, &sb, FTW_D);
  926. +        if ( (rval && rval != NODESC) || (rval = walk(name)))
  927. +            break;
  928. +        if (g_opts & FTW_DIRLAST) {
  929. +            *save = '\0';
  930. +            rval = (*g_fn) (dp->d_name, &sb, FTW_D2);
  931. +            if (rval)
  932. +                if (rval == NODESC)
  933. +                    rval = 0;
  934. +                else
  935. +                    break;
  936. +        }
  937. +        if (cur.off) {
  938. +            *name = NULL;
  939. +            if ( (cur.dirp = opendir(bp)) ) {
  940. +                seekdir(cur.dirp, cur.off);
  941. +                /* tricky; if we have to reset the directory pointer we know
  942. +                 * it's the next one to reuse */
  943. +                freep = &cur;
  944. +                --g_fds;
  945. +            }
  946. +            /* directory moved from under us!!! */
  947. +            else {
  948. +                rval = -1;
  949. +                break;
  950. +            }
  951. +        }
  952. +    }
  953. +    closedir(cur.dirp);
  954. +    ++g_fds;
  955. +    return (rval);
  956. +}
  957. +
  958. +static int
  959. +chwalk(register char *name)
  960. +{
  961. +#ifdef HAVE_DIRENT
  962. +    register struct dirent *dp;
  963. +#else
  964. +    register struct direct *dp;
  965. +#endif
  966. +
  967. +    register int rval;
  968. +    struct stat sb;
  969. +    FD cur;
  970. +    char *pwd,
  971. +     *getwd(char *),
  972. +#ifndef NO_MALLOC_PROTO
  973. +     *malloc(size_t),
  974. +#endif
  975. +     *strcpy(char *, const char *);
  976. +
  977. +    if (!freep)
  978. +        freep = &cur;
  979. +    else
  980. +        node->next = &cur;
  981. +    node = &cur;
  982. +    cur.off = 0;
  983. +
  984. +    if (chdir(name))
  985. +        return (errno == EACCES ? (*g_fn) (name, &sb, FTW_DNR) : -1);
  986. +
  987. +  getfd:if (!g_fds) {
  988. +        freep->off = telldir(freep->dirp);
  989. +        closedir(freep->dirp);
  990. +        freep = freep->next;
  991. +        ++g_fds;
  992. +    }
  993. +    if ( !(cur.dirp = opendir(".")) )  {
  994. +        if (errno == EMFILE) {
  995. +            g_fds = 0;
  996. +            goto getfd;
  997. +        }
  998. +        return (errno == EACCES ? (*g_fn) (".", &sb, FTW_DNR) : -1);
  999. +    } else
  1000. +        --g_fds;
  1001. +
  1002. +    for (rval = 0, dp = readdir(cur.dirp); dp; dp = readdir(cur.dirp)) {
  1003. +        if (ISDOT(dp))
  1004. +            continue;
  1005. +        if (lstat(dp->d_name, &sb)) {
  1006. +            rval = errno == EACCES ?
  1007. +                (*g_fn) (dp->d_name, &sb, FTW_NS) : -1;
  1008. +            if (rval)
  1009. +                break;
  1010. +        }
  1011. +        pwd = NULL;
  1012. +#ifdef HAVE_SYMLINK
  1013. +        if (ISLINK(sb) && g_opts & FTW_SYMLINK) {
  1014. +            if (stat(dp->d_name, &sb))
  1015. +                continue;
  1016. +            if (ISDIR(sb)) {
  1017. +                /* NOSTRICT */
  1018. +                if (!(pwd = malloc((u_int) MAXPATHLEN))) {
  1019. +                    rval = -1;
  1020. +                    break;
  1021. +                }
  1022. +                if (!getwd(pwd)) {
  1023. +                    rval = -1;
  1024. +                    break;
  1025. +                }
  1026. +            }
  1027. +        }
  1028. +#endif
  1029. +        if (!ISDIR(sb)) {
  1030. +            rval = (*g_fn) (dp->d_name, &sb, FTW_F);
  1031. +            if (rval)
  1032. +                break;
  1033. +            continue;
  1034. +        }
  1035. +        rval = (*g_fn) (dp->d_name, &sb, FTW_D);
  1036. +        if ((rval && rval != NODESC) || (rval = chwalk(dp->d_name)))
  1037. +            break;
  1038. +        if (g_opts & FTW_DIRLAST) {
  1039. +            rval = (*g_fn) (dp->d_name, &sb, FTW_D2);
  1040. +            if (rval)
  1041. +                if (rval == NODESC)
  1042. +                    rval = 0;
  1043. +                else
  1044. +                    break;
  1045. +        }
  1046. +        if (pwd && chdir(pwd)) {
  1047. +            rval = -1;
  1048. +            break;
  1049. +        }
  1050. +        if (cur.off) {
  1051. +            if ( (cur.dirp = opendir(".")) ) {
  1052. +                seekdir(cur.dirp, cur.off);
  1053. +                /* tricky; if we have to reset the directory pointer we know
  1054. +                 * it's the next one to reuse */
  1055. +                freep = &cur;
  1056. +                --g_fds;
  1057. +            }
  1058. +            /* directory moved from under us!!! */
  1059. +            else {
  1060. +                rval = -1;
  1061. +                break;
  1062. +            }
  1063. +        }
  1064. +    }
  1065. +    closedir(cur.dirp);
  1066. +    ++g_fds;
  1067. +    if (chdir(".."))
  1068. +        return (-1);
  1069. +    return (rval);
  1070. +}
  1071. +
  1072. +/* S5 compatible ftw(BA_LIB) */
  1073. +int
  1074. +ftw(char *path, int (*fn) ( /* ??? */ ), int maxfds)
  1075. +{
  1076. +    return (treewalk(path, fn, maxfds, 0));
  1077. +}
  1078. +
  1079. +int
  1080. +treewalk(char *path, int (*fn) ( /* ??? */ ), int maxfds, int opts)
  1081. +{
  1082. +    struct stat sb;
  1083. +    int rval;
  1084. +    char *pwd,
  1085. +     *getwd(char *),
  1086. +#ifndef NO_MALLOC_PROTO
  1087. +     *malloc(size_t),
  1088. +#endif
  1089. +     *strcpy(char *, const char *);
  1090. +
  1091. +    if (lstat(path, &sb))
  1092. +        return (errno == EACCES ? (*fn) (path, &sb, FTW_NS) : -1);
  1093. +
  1094. +    pwd = NULL;
  1095. +#ifdef HAVE_SYMLINK
  1096. +    if (ISLINK(sb) && opts & FTW_SYMLINK) {
  1097. +        if (stat(path, &sb))
  1098. +            return (0);
  1099. +        if (ISDIR(sb)) {
  1100. +            /* NOSTRICT */
  1101. +            if (!(pwd = malloc((u_int) MAXPATHLEN)))
  1102. +                return (-1);
  1103. +            if (!getwd(pwd))
  1104. +                return (-1);
  1105. +        }
  1106. +    }
  1107. +#endif
  1108. +    if (!ISDIR(sb))
  1109. +        return ((*fn) (path, &sb, FTW_F));
  1110. +
  1111. +    if (!maxfds)
  1112. +        return (-1);
  1113. +    g_fds = maxfds == -1 ? getdtablesize(): maxfds;
  1114. +    g_fn = fn;
  1115. +    g_opts = opts;
  1116. +
  1117. +    if (!(opts & FTW_CHDIR) && !(bp = malloc((u_int) MAXPATHLEN))) {
  1118. +        errno = ENOMEM;
  1119. +        return (-1);
  1120. +    }
  1121. +    rval = (*fn) (path, &sb, FTW_D);
  1122. +    if (rval == NODESC)
  1123. +        rval = 0;
  1124. +    else if (!rval) {
  1125. +        if (opts & FTW_CHDIR)
  1126. +            rval = chwalk(path);
  1127. +        else
  1128. +            rval = walk(strcpy(bp, path));
  1129. +        if (!rval && opts & FTW_DIRLAST) {
  1130. +            rval = (*fn) (path, &sb, FTW_D2);
  1131. +            if (rval == NODESC)
  1132. +                rval = 0;
  1133. +        }
  1134. +    }
  1135. +    if (pwd && chdir(pwd))
  1136. +        return (-1);
  1137. +    return (rval);
  1138. +}
  1139. diff -r -u --new-file wu-ftpd-2.4/support/makefiles/Makefile.lnx wu-ftpd-2.4-fixed/support/makefiles/Makefile.lnx
  1140. --- wu-ftpd-2.4/support/makefiles/Makefile.lnx    Fri Apr  1 14:03:52 1994
  1141. +++ wu-ftpd-2.4-fixed/support/makefiles/Makefile.lnx    Sat Jun  3 13:14:12 1995
  1142. @@ -1,21 +1,30 @@
  1143.  CC     = gcc 
  1144. +COMPILEONLY = -c
  1145.  AR     = ar cq
  1146.  RANLIB = ranlib
  1147. -LIBC   = /lib/libc.a
  1148. -IFLAGS = 
  1149. +LIBC   = /usr/lib/libc.a
  1150. +IFLAGS = -I/usr/include/bsd
  1151.  LFLAGS = 
  1152. -CFLAGS = -O -DDEBUG ${IFLAGS} ${LFLAGS}
  1153. +CFLAGS = -O2 $(IFLAGS) $(LFLAGS) -m486 -pipe
  1154.  
  1155.  SRCS   = getusershell.c fnmatch.c strcasestr.c strerror.c authuser.c ftw.c
  1156.  OBJS   = getusershell.o fnmatch.o strcasestr.o strerror.o authuser.o ftw.o
  1157.   
  1158. -all: $(OBJS)
  1159. -     -rm -f libsupport.a
  1160. -     ${AR} libsupport.a $(OBJS)
  1161. -     ${RANLIB} libsupport.a
  1162. +
  1163. +all: $(OBJ)
  1164. +      rm -rf libsupport.a
  1165. +      $(CC) $(CFLAGS) $(COMPILEONLY) $(SRCS) 
  1166. +      $(AR) libsupport.a $(OBJS)
  1167. +      $(RANLIB) libsupport.a
  1168. +
  1169. +#all: $(OBJS)
  1170. +#
  1171. +#     rm -f libsupport.a
  1172. +#     ${AR} libsupport.a $(OBJS)
  1173. +#     ${RANLIB} libsupport.a
  1174. +# 
  1175.  clean:
  1176. -    -rm -f *.o libsupport.a
  1177. +    rm -f *.o libsupport.a
  1178.  
  1179.  ftp.h:
  1180.      install -c -m 444 ftp.h /usr/include/arpa
  1181. @@ -24,25 +33,25 @@
  1182.      install -c -m 444 paths.h /usr/include
  1183.  
  1184.  fnmatch.o: fnmatch.c
  1185. -    ${CC} ${CFLAGS} -c fnmatch.c
  1186. +    $(CC) $(CFLAGS) -c fnmatch.c
  1187.  
  1188.  getusershell.o: getusershell.c
  1189. -    ${CC} ${CFLAGS} -c getusershell.c
  1190. +    $(CC) $(CFLAGS) -c getusershell.c
  1191.  
  1192.  strerror.o: strerror.c
  1193. -    ${CC} ${CFLAGS} -c strerror.c
  1194. +    $(CC) $(CFLAGS) -c strerror.c
  1195.  
  1196.  strdup.o: strdup.c
  1197. -    ${CC} ${CFLAGS} -c strdup.c
  1198. +    $(CC) $(CFLAGS) -c strdup.c
  1199.  
  1200.  strcasestr.o: strcasestr.c
  1201. -    ${CC} ${CFLAGS} -c strcasestr.c
  1202. +    $(CC) $(CFLAGS) -c strcasestr.c
  1203.  
  1204.  strsep.o: strsep.c
  1205. -    ${CC} ${CFLAGS} -c strsep.c
  1206. +    $(CC) $(CFLAGS) -c strsep.c
  1207.  
  1208.  authuser.o: authuser.c
  1209. -    ${CC} ${CFLAGS} -c authuser.c
  1210. +    $(CC) $(CFLAGS) -c authuser.c
  1211.  
  1212.  ftw.o: ftw.c
  1213. -    ${CC} ${CFLAGS} -c ftw.c
  1214. +    $(CC) $(CFLAGS) -c ftw.c
  1215.